Skip to content

fix(xref): raise on --min-cycle-label <= 0#15027

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
davydog187:fix-xref-bug
Dec 30, 2025
Merged

fix(xref): raise on --min-cycle-label <= 0#15027
josevalim merged 1 commit into
elixir-lang:mainfrom
davydog187:fix-xref-bug

Conversation

@davydog187
Copy link
Copy Markdown
Contributor

Provides an error message in favor of

mix xref graph --format cycles --min-cycle-label 0 --label compile-connected
** (FunctionClauseError) no function clause matching in Enum.count_until/3

    The following arguments were given to Enum.count_until/3:

        # 1
        [{"lib/foo.ex", nil}, {"lib/bar.ex", nil}]

        # 2
        #Function<4.83728021/1 in Mix.Tasks.Xref.cycle_filter_fn/1>

        # 3
        0

    Attempted function clauses (showing 1 out of 1):

        def count_until(enumerable, fun, limit) when is_integer(limit) and limit > 0

    (elixir 1.19.4) lib/enum.ex:783: Enum.count_until/3
    (mix 1.19.4) lib/mix/tasks/xref.ex:1247: anonymous fn/3 in Mi

Provides an error message in favor of

```
mix xref graph --format cycles --min-cycle-label 0 --label compile-connected
** (FunctionClauseError) no function clause matching in Enum.count_until/3

    The following arguments were given to Enum.count_until/3:

        # 1
        [{"lib/foo.ex", nil}, {"lib/bar.ex", nil}]

        # 2
        #Function<4.83728021/1 in Mix.Tasks.Xref.cycle_filter_fn/1>

        # 3
        0

    Attempted function clauses (showing 1 out of 1):

        def count_until(enumerable, fun, limit) when is_integer(limit) and limit > 0

    (elixir 1.19.4) lib/enum.ex:783: Enum.count_until/3
    (mix 1.19.4) lib/mix/tasks/xref.ex:1247: anonymous fn/3 in Mi
```
davydog187 added a commit to davydog187/elixir that referenced this pull request Dec 30, 2025
As a follow up to elixir-lang#15027, provide a nicer error message when invoking
`Enum.count_until` with an invalid limit
@josevalim josevalim merged commit 3c8fe86 into elixir-lang:main Dec 30, 2025
11 checks passed
@josevalim
Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants